﻿
window.operateEvents = {
    'click .ffjfk': function (e, value, row, index) {
        MyDialog.confirm("你确定要进行此项操作？", function () {
            $.post("../SpeList/DLLAjaxHandler.ashx", { Action: "JFK_STATUS", id: row.ID, status: "已发放", remark: "" },
                function (data) {
                    if (data == "success") {
                        $("#FTGrid").bootstrapTable('updateRow', {
                            index: index,
                            row: {
                                Status: "已发放"
                            }
                        });
                        toastr.success("操作成功");

                    } else {
                        toastr.error("操作失败");
                    }
                }
            )
        })
    },
    'click .deljfk': function (e, value, row, index) {
        if (row.Status == "未发放") {
            MyDialog.confirm("你确定要进行此项操作？", function () {
                $.get("../Comon/ComAjaxHandler.ashx", { Action: "DelFormData", FormCode: "JFKGL", FormID: row.ID },
                    function (data) {
                        if (data == "success") {
                            toastr.success("操作成功");
                            location.reload();
                        } else {
                            toastr.error("操作失败");
                        }
                    }
                )
            })
        } else {
            toastr.error("你只能删除未发放的积分卡");

        }

    }
};
var option = {};
option.columns = [
             {
                 field: 'ID',
                 title: '序号'
             }, {
                 sortable: true,
                 field: 'CardNo',
                 title: '积分卡卡号'
             }, {
                 field: 'CardPwd',
                 title: '积分卡密码',
             }
             , {
                 field: 'CardValue',
                 title: '积分卡金额',
             }, {
                 field: 'BindUser',
                 title: '绑定用户',
             }, {
                 field: 'BindTime',
                 title: '绑定时间',
             }
             , {
                 field: 'Status',
                 title: '状态',
             }
             , {
                 field: 'CreateUser',
                 title: '操作',
                 formatter: function (value, row, index) {
                     if (row.Status == "未发放") {
                         return "<a  class='ffjfk' href='#'>发放积分卡</a><a  class='deljfk' href='#' style='color:red;margin-left:20px'>删除</a>";

                     } else {
                         return "-";
                     }
                 },
                 events: operateEvents

             }
];

$(document).ready(function () {
    $(".EditForm,.DelForm").remove();

});
